import { Controller, Get } from '@nestjs/common';
import { AppService } from './app.service';
import { MessagePattern } from '@nestjs/microservices';

@Controller()
export class AppController {
  constructor(private readonly appService: AppService) {}

// 接受 sum 消息，返回求和的结果的 handler
@MessagePattern('sum')
sum(number:Array<number>):number{
  return number.reduce((total,item)=>total + item,0)
}
}
